<?php
/********************************************************
** Copyright 2010-2013. Todos los derechos reservados. **
** Desarrollado y Gestionado por:					   **
** Sugey Quintero (Analista)						   **
** José G. De Freitas (Programador)					   **
** Klaudia Uribe (Diseñadora Web)					   **
** Cesar Isturiz (Diseñador Web)					   **
**				S E A  v1.0							   **
*********************************************************/

session_start();
include("conexion.php");

	if (isset($_SESSION['name']) and isset($_SESSION['tiempo'])) {
        include("Tiempo.php");
	date_default_timezone_set('America/Caracas'); setlocale(LC_TIME, 'spanish');
	$usuario = $_SESSION['name'];
	$fecha = date("Y-m-d H:i:s");
	$auditoria = mysql_query("INSERT INTO auditoria SELECT '$usuario', '$fecha' , 'Auditoria' ");

    }else {
		echo "<script>alert('Debe ingresar al sistema primero');</script>";
		echo "<script>document.location.href='index.php';</script>";
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Auditoria</title>
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link href="style.css" rel="stylesheet" type="text/css" />
<!-- calendario-->
<link rel="stylesheet" type="text/css" href="src/css/jscal2.css">
<link rel="stylesheet" type="text/css" href="src/css/border-radius.css">
<link rel="stylesheet" type="text/css" href="src/css/steel/steel.css">
<script type="text/javascript" src="src/js/jscal2.js"></script>
<script type="text/javascript" src="src/js/lang/es.js"></script>
<!-- fin calendario-->
<!-- botones-->
<link type="text/css" href="js/css/smoothness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />      
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script>
var j$ = jQuery.noConflict();
j$(document).ready(function(){
j$(".button").button();

j$(function(){
	j$('#menu li a').click(function(event){
		var elem = j$(this).next();
		if(elem.is('ul')){
			event.preventDefault();
			j$('#menu ul:visible').not(elem).slideUp();
			elem.slideToggle();
		}
	});
});

function loading_show(){
	j$('#loading').html("<img src='images/loading.gif'/>").fadeIn('fast');
}

function loading_hide(){
	j$('#loading').fadeOut('fast');
}

function loadData(page){
	loading_show();                    
	j$.ajax({
		type: "POST",
		url: "CargarDatos.php",
		data: "page="+page+"&Fecha="+document.getElementById("Fecha").value+"&Fecha2="+document.getElementById("Fecha2").value+"&Usuario="+document.getElementById("Usuario").value,
		success: function(msg){
			j$("#container").ajaxComplete(function(event, request, settings){
				loading_hide();
				j$("#container").html(msg);
			});
		}
	});
}
	loadData(1);  // For first time page load default results
	j$('#container .pagination li.active').live('click',function(){
		var page = j$(this).attr('p');
		loadData(page);
	});
});

function mostrar(a){ 
	if(a==1){
		document.getElementById('table').style.display="inline";
		document.getElementById('up').style.display="inline";
		document.getElementById('down').style.display="none";
	}else if(a==2){
		document.getElementById('table').style.display="none";
		document.getElementById('up').style.display="none";
		document.getElementById('down').style.display="inline";
	}
}
</script>
<!-- fin botones-->
<style type="text/css">
            #loading{
                width: 100%;
                position: absolute;
                top: 100px;
                left: 100px;
				margin-top:350px;
            }
            #container .pagination ul li.inactive,
            #container .pagination ul li.inactive:hover{
                background-color:#ededed;
                color:#bababa;
                border:1px solid #bababa;
                cursor: default;
            }
            #container .data ul li{
                list-style: none;
                font-family: verdana;
                margin: 5px 0 5px 0;
                color: #000;
                font-size: 13px;
            }

            #container .pagination{
                width: 100%;
                height: 25px;
                position: relative;
                left: 40px;
				margin-top:0px;
            }
            #container .pagination ul li{
                list-style: none;
                float: left;
                border: 1px solid #006699;
                padding: 2px 6px 2px 6px;
                margin: 0 3px 0 3px;
                font-family: arial;
                font-size: 14px;
                color: #006699;
                font-weight: bold;
                background-color: #f2f2f2;
            }
            #container .pagination ul li:hover{
                color: #fff;
                background-color: #006699;
                cursor: pointer;
            }
</style>
</head>

<body>
<div id="wrap">
<div id="header">
<div id="hora">
<?php include("Hora.php"); ?>
</div>
<div id="topnav">
	<?php include("MenuSuperior.php"); ?>
</div>


</div>
<div id="content">
<div id="left">
<div class="post">
<div class="post_h">

</div>

<div class="postcontent">

<blockquote><h2 align="center">AUDITORIAS</h2></blockquote>
			<fieldset>
			<legend align=left><b><font size=2>BUSCADOR</font></b></legend>
			<center>
			<table width=100% cellspacing=3 cellpadding=0 border=0>
			<tr>
				<th>Usuario: </th>
				<td><input type=text id="Usuario" name="Usuario"></td>
				<th>Desde: </th>
				<td align=center><input readonly type=text id="Fecha" name="Fecha" size=10><img src="images/calendar.gif" id="calendar-trigger" width=16% align=top>
						<script>
							Calendar.setup({
								trigger    : "calendar-trigger",
								inputField : "Fecha",
								dateFormat : "%Y-%m-%d",
								onSelect   : function() { this.hide() }
							});
						</script></td>
				<th>Hasta: </th>
				<td align=center><input readonly type=text id="Fecha2" name="Fecha2" size=10><img src="images/calendar.gif" id="calendar-trigger2" width=16% align=top>
						<script>
							Calendar.setup({
								trigger    : "calendar-trigger2",
								inputField : "Fecha2",
								dateFormat : "%Y-%m-%d",
								onSelect   : function() { this.hide() }
							});
						</script></td>
			</tr>
			</table>
			</center>
			</fieldset>

<div class="post">
<span></span></div>

			<fieldset>
			<legend align=left><b><font size=2>ELIMINAR AUDITORIAS</font></b><img src="images/down.png" id='down' onClick="mostrar(1)" width=10% align=top title='Presione aqui para mostrar'><img src="images/up.png" id='up' style='display:none;' onClick="mostrar(2)" width=10% align=top title='Presione aqui para ocultar'></legend>
			<div align=center id='table' style='display:none;'>
			<form action='EliminarAuditoria.php' method=GET>
			<table width=100% cellspacing=3 cellpadding=0 border=0>
			<tr>
				<th>Usuario:</th>
				<th><input type=text id="UsuarioE" name="UsuarioE" size=10> Y/O
				Desde:<input readonly type=text id="FechaE" name="FechaE" size=8><img src="images/calendar.gif" id="calendar-triggerE" width=8% align=top>
						<script>
							Calendar.setup({
								trigger    : "calendar-triggerE",
								inputField : "FechaE",
								dateFormat : "%Y-%m-%d",
								onSelect   : function() { this.hide() }
							});
						</script></th>
				<th>Hasta: <input readonly type=text id="FechaE2" name="FechaE2" size=8><img src="images/calendar.gif" id="calendar-triggerE2" width=15% align=top>
						<script>
							Calendar.setup({
								trigger    : "calendar-triggerE2",
								inputField : "FechaE2",
								dateFormat : "%Y-%m-%d",
								onSelect   : function() { this.hide() }
							});
						</script></th>
			<td><input class=button type=submit value='Eliminar' onclick="return confirm('\u00bfSeguro que desea eliminarlo?')"></td>
			</tr>
			</table>
			</form>
			</div>
			</fieldset>

<div class="post">
<span></span></div>

<fieldset>
<table width=100% cellspacing=5 cellpadding=3 border=0>
<div id="loading" align=center></div>
	<tr>
<div id="container">
		<div class="data"></div>
		<div class="pagination" align=center></div>
</div></tr>
</table>
</fieldset>

<div name="botonera" align=center>
	<input class=button type=button value=Volver onClick="location='index.php'">
</div>

</div>
<div class="post_b">
<span></span></div>
</div>


</div>

<div class="post">
<div class="post_h">

</div>


</div>

<?php include("Menu.php"); ?>

<div class="clear"></div>
</div>
<div id="pagebottom"></div>

<div id="footer">
<P>&reg; Derechos Reservados @ CopyRight. 2011-2012</P>
<p>Programadores: Quintero E, Isturiz C, Uribe C, De Freitas J.</p>
</div>
</div>
</body>
</html>
